<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <link rel="stylesheet" type="text/css" th:href="@{/static/layui-v2.6.13/layui/css/layui.css}"/>
  <script type="text/javascript" th:src="@{/static/layui-v2.6.13/layui/layui.js}"></script>
  <script type="text/javascript" th:src="@{/static/js/jquery-1.9.1.min.js}"></script>
</head>
<body>
<div>
  <span>添加类名:</span><input type="text" id="name">
</div>
<div>
  <button type="button" onclick="add()">添加</button>
</div>
</body>
<script>
  layui.use('layer',function(){
    var layer = layui.layer;
  });
  function add(){
    var name = $("#name").val();
    $.ajax({
      url:'addtype?name='+name,
      success: function(obj){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
        alert("添加成功");
      }
    });
  }
</script>
</html>